﻿using System;
using GeoAPI.Geometries;
using GeoAPI.Geometries.Prepared;

namespace NetTopologySuite.Geometries.Prepared
{
	public class PreparedGeometryFactory
	{
		public static IPreparedGeometry Prepare(IGeometry geom)
		{
			return new PreparedGeometryFactory().Create(geom);
		}

		public IPreparedGeometry Create(IGeometry geom)
		{
			if (geom is IPolygonal)
			{
				return new PreparedPolygon((IPolygonal)geom);
			}
			if (geom is ILineal)
			{
				return new PreparedLineString((ILineal)geom);
			}
			if (geom is IPuntal)
			{
				return new PreparedPoint((IPuntal)geom);
			}
			return new BasicPreparedGeometry(geom);
		}
	}
}
